#!/bin/sh

ROOT=/
if [ -n "$PKGROOT" ]
then
	ROOT=$PKGROOT
fi

if [ `uname` = "HP-UX" ]
then
	# If the required link in run level three does not exist
	# then add it... If running in non-root location copy it
	# to the root location...

	if [ ! -a /sbin/init.d/tp2 ]
	then
		if [ -a $PKGROOT/init.d/tp2 ]
		then
			cp $PKGROOT/init.d/tp2 /sbin/init.d/tp2
			chmod 555 /sbin/init.d/tp2
		fi
	fi

	if [ ! -a /sbin/rc3.d/S900tp2 ]
	then
		cd /sbin/rc3.d
		ln -sf ../init.d/tp2 S900tp2
		cd /sbin/rc2.d
		ln -sf ../init.d/tp2 K900tp2
		cd /sbin/rc1.d
		ln -sf ../init.d/tp2 K900tp2
	fi

	if [ ! -a /etc/rc.config.d/tp2 ]
	then
		cp $PKGROOT/etc/tp2.example /etc/rc.config.d/tp2
		chmod 444 /etc/rc.config.d/tp2
	fi
fi

exit 0
